<?php
namespace common\sources\read\loginrole;

use \common\models\craftsman\LoginRole;

class LoginRoleAccess implements ILoginRoleAccess
{
    //获取系统角色列表
    public function getRoleList()
    {
        $roleList = LoginRole::find()
            ->select("roleid,role_name")
            ->asArray()
            ->all();
        return $roleList;
    }

    //获取角色权限
    public function getRolePower($role)
    {
        $powerids = LoginRole::find()
            ->select("powerid")
            ->where(['roleid' => $role])
            ->scalar();
        return $powerids;
    }

    //获取详情
	public function getRoleInfo($id) {
		return LoginRole::find()->select("roleid,role_name,description")->where(['roleid' => $id])->asArray()->one();
	}
}